package com.higgins.server;
import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.MapsId;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.GenericGenerator;

import com.higgins.client.dataModel.StrategyDTO;
import com.higgins.client.dataModel.StrategyRecipientDTO;

@Entity
@Table(name = "strategyRecipients")
public class StrategyRecipient {

    @Id 
    @GeneratedValue(generator = "increment")
    @GenericGenerator(name = "increment", strategy = "increment")
	private Long id;
    
    @Column(name="strategyId")
    private Long strategyId;
    
    @Column(name="recipientId")
    private Long recipientId;
    
    @Column(name="lawFirmId")
    private Long lawFirmId;
    
    @Column(name="regionId")
    private Long regionId;
    
    @Column(name="sectorId")
    private Long sectorId;
    
    @Column(name="status")
    private Integer status;
    
    @Column(name="disabled")
    private Boolean disabled;

    @Column(name="publishRequestTimestamp")
    private Date publishRequestTimestamp;

    @Column(name="documentGeneratedTimestamp")
    private Date documentGeneratedTimestamp;
    
    @Column(name="postedTimestamp")
    private Date postedTimestamp;

    public StrategyRecipient() {
        // This is used by JPA
    }

    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public Long getStrategyId()	{
    	return strategyId;
    }
    public void setStrategyId(Long strategyId)	{
    	this.strategyId = strategyId;
    }
    public Long getRecipientId()	{
    	return recipientId;
    }
    public void setRecipientId(Long recipientId)	{
    	this.recipientId = recipientId;
    }
    public Long getLawFirmId()	{
    	return lawFirmId;
    }
    public void setLawFirmId(Long lawFirmId)	{
    	this.lawFirmId = lawFirmId;
    }
    public Long getRegionId()	{
    	return regionId;
    }
    public void setRegionId(Long regionId)	{
    	this.regionId = regionId;
    }
    public Long getSectorId()	{
    	return sectorId;
    }
    public void setSectorId(Long sectorId)	{
    	this.sectorId = sectorId;
    }
	public Integer getStatus()	{
		return status;
	}
	public void setStatus(Integer status)	{
		this.status = status;
	}
	public Boolean getDisabled()	{
		return disabled;
	}
	public void setDisabled(Boolean disabled)	{
		this.disabled = disabled;
	}
    public Date getPublishRequestTimestamp()	{
    	return publishRequestTimestamp;
    }
    public void setPublishRequestTimestamp(Date publishRequestTimestamp)	{
    	this.publishRequestTimestamp = publishRequestTimestamp;
    }
    public Date getDocumentGeneratedTimestamp()	{
    	return documentGeneratedTimestamp;
    }
    public void setDocumentGeneratedTimestamp(Date documentGeneratedTimestamp)	{
    	this.documentGeneratedTimestamp = documentGeneratedTimestamp;
    }
    public Date getPostedTimestamp()	{
    	return postedTimestamp;
    }
    public void setPostedTimestamp(Date postedTimestamp)	{
    	this.postedTimestamp = postedTimestamp;
    }
    public StrategyRecipientDTO toDTO()	{
    	StrategyRecipientDTO dto = new StrategyRecipientDTO();
    	dto.setId(id);
    	dto.setRecipientId(recipientId);
    	dto.setLawFirmId(lawFirmId);
    	dto.setStrategyId(strategyId);
    	dto.setRegionId(regionId);
    	dto.setSectorId(sectorId);
    	dto.setStatus(status);
    	dto.setDisabled(disabled);
    	dto.setPublishRequestTimestamp(publishRequestTimestamp);
    	dto.setDocumentGeneratedTimestamp(documentGeneratedTimestamp);
    	dto.setPostedTimestamp(postedTimestamp);
    	return dto;
    }
    public void update(StrategyRecipientDTO dto)	{
    	this.strategyId = dto.getStrategyId();
    	this.recipientId = dto.getRecipientId();
    	this.lawFirmId = dto.getLawFirmId();
    	this.regionId = dto.getRegionId();
    	this.sectorId = dto.getSectorId();
//    	this.status = dto.getStatus();
    	this.disabled = dto.getDisabled();
//    	this.publishRequestTimestamp = dto.getPublishRequestTimestamp();
//    	this.documentGeneratedTimestamp = dto.getDocumentGeneratedTimestamp();
//    	this.postedTimestamp = dto.getPostedTimestamp();
    }
}